import Vue from 'vue'
import Vuex from 'vuex'
import getters from "@/store/getters";
import createPersistedState from "vuex-persistedstate";

/**
 * modules
 */
import app from "@/store/modules/app";
import frontend from "@/store/modules/frontend";
import city from "@/store/modules/city";
import career from "@/store/modules/career";
import company from "@/store/modules/company";
import resume from "@/store/modules/resume";
import news from "@/store/modules/news";

Vue.use(Vuex)

// 新建并暴露store
export default new Vuex.Store({
    getters,
    modules: {
        app,
        frontend,
        city,
        career,
        company,
        resume,
        news
    },
    plugins: [createPersistedState(
        {
            storage: window.localStorage,
            key: "store",
            // 全部持久化
            reducer(state) {
                return { ...state }
            },
            // 模块持久化
            // paths: ['app']
        }
    )]
})
